import 'package:flutter/material.dart';
import 'package:flutter_htmlful/flutter_htmlful.dart';

import '../../config/configs.dart';

class TongDiaoZhePage extends StatefulWidget {
  const TongDiaoZhePage({super.key});

  @override
  State<TongDiaoZhePage> createState() => _TongDiaoZhePageState();
}

class _TongDiaoZhePageState extends State<TongDiaoZhePage> with SingleTickerProviderStateMixin {
  dynamic detail;
  late TabController tabController;

  @override
  void initState() {
    super.initState();
    tabController = TabController(length: 2, vsync: this);
  }

  @override
  void dispose() {
    tabController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    detail = ModalRoute.of(context)?.settings.arguments;
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: AppBar(
        title: const Text("同调者详情"),
      ),
      body: Container(
        height: double.infinity,
        width: double.infinity,
        child: SingleChildScrollView(
          child: Container(
            child: Column(
              children: [
                Card(
                  child: Div(
                    body: [
                      Img(
                        src: detail?['logo'] ?? defaultImage,
                        style: Style(width: 150, height: 150, fit: BoxFit.fill, marginRight: 10),
                      ),
                      Div(
                        body: [
                          Text(detail?['name'] ?? "--"),
                          const Divider(
                            height: 1,
                            thickness: 1,
                            color: Colors.red,
                          ),
                          Text("职业：" + (detail?['career'] ?? "--")),
                          Text("属性：" + (detail?['shu_xing'] ?? "--")),
                          Text('星级： ${detail?['star'] ?? "--"}'),
                          Text("定位：" + (detail?['positioning'] ?? "--")),
                        ],
                      )
                    ],
                    style: Style(direction: Axis.horizontal, padding: 10),
                  ),
                ),
                TabBar(
                  controller: tabController,
                  tabs: const [
                    Tab(
                      text: '基本信息',
                    ),
                    Tab(
                      text: '技能',
                    )
                  ],
                ),
                Container(
                  width: double.infinity,
                  child: DataTable(
                    columns: [DataColumn(label: Text('姓名')), DataColumn(label: Text('年龄'))],
                    rows: [
                      DataRow(cells: [DataCell(Text('老孟')), DataCell(Text('18'))]),
                    ],
                  ),
                ),
                Container(
                  child: Table(
                    children: [
                      TableRow(children: [Text('11111111111111'), Text('222222222222222')]),
                      TableRow(children: [Text('aaaaa'), Text('bbbb')])
                    ],
                  ),
                )
              ],
            ),
          ),
        ),
      ),
    );
  }

  Style padding10 = Style(padding: 10);
}
